package com.imooc.mall.common;

import com.imooc.mall.enums.ResultEnum;

public class ResultInfoUtil {

    public static ResultInfo success(Object o){
        ResultInfo resultInfo=new ResultInfo();
        resultInfo.setStatus(ResultEnum.SUCCESS.getCode());
        resultInfo.setMsg(ResultEnum.SUCCESS.getMsg());
        resultInfo.setData(o);
        return resultInfo;
    }
    public static ResultInfo withOutStatusSuccess(Object o){
        ResultInfo resultInfo=new ResultInfo();
        resultInfo.setMsg(ResultEnum.SUCCESS.getMsg());
        resultInfo.setData(o);
        return resultInfo;
    }

    public static ResultInfo success(){
        return success(null);
    }

    public static ResultInfo error(Integer code,String msg){
        ResultInfo resultInfo=new ResultInfo();
        resultInfo.setStatus(code);
        resultInfo.setMsg(msg);
        //resultInfo.setData(o);
        return resultInfo;
    }
}
